#ifndef SEQIOT_CHANNEL_H
#define SEQIOT_CHANNEL_H

#include <stdio.h>
#include <stdlib.h>
#include "model.h"

int channel_open_serial(channel_t *channel);

void channel_close(channel_t *channel);

ssize_t channel_read(channel_t *channel, void *ptr, size_t nbytes);

ssize_t channel_write(channel_t *channel, const void *ptr, size_t nbytes);

_Bool is_retry_sched(device_t *device);

void update_stats(device_t *device, channel_t *channel, int rc);

//计算下次计划时间
time_t next_sched(time_t now, interval_t *interval);

#endif //SEQIOT_CHANNEL_H
